// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   TdTag.java

package com.vandagroup.common.taglib.html;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
import org.apache.struts.util.ResponseUtils;

public class TdTag extends TagSupport
{

    protected String type;
    protected String cellType;
    protected String styleClass;
    protected String style;
    protected String width;
    protected String height;
    protected String bgColor;
    protected boolean nowrap;

    public TdTag()
    {
        type = null;
        cellType = null;
        styleClass = null;
        style = null;
        width = null;
        height = null;
        bgColor = null;
        nowrap = false;
    }

    public String getHeight()
    {
        return height;
    }

    public String getStyle()
    {
        return style;
    }

    public String getStyleClass()
    {
        return styleClass;
    }

    public String getType()
    {
        return type;
    }

    public void setHeight(String height)
    {
        this.height = height;
    }

    public void setStyle(String style)
    {
        this.style = style;
    }

    public void setStyleClass(String styleClass)
    {
        this.styleClass = styleClass;
    }

    public void setType(String type)
    {
        this.type = type;
    }

    public String getBgColor()
    {
        return bgColor;
    }

    public void setBgColor(String bgColor)
    {
        this.bgColor = bgColor;
    }

    public String getCellType()
    {
        return cellType;
    }

    public String getWidth()
    {
        return width;
    }

    public void setCellType(String cellType)
    {
        this.cellType = cellType;
    }

    public void setWidth(String width)
    {
        this.width = width;
    }

    public boolean isNowrap()
    {
        return nowrap;
    }

    public void setNowrap(boolean nowrap)
    {
        this.nowrap = nowrap;
    }

    public int doStartTag()
        throws JspException
    {
        StringBuffer sb = new StringBuffer("<td");
        if(type == null)
        {
            sb.append(height == null ? "" : " height=\"" + height + "\"");
            sb.append(width == null ? "" : " width=\"" + width + "\"");
            sb.append(styleClass == null ? "" : " class=\"" + styleClass + "\"");
            sb.append(style == null ? "" : " style=\"" + style + "\"");
            sb.append(bgColor == null ? "" : " bordercolor=\"" + bgColor + "\"");
        } else
        if(type.toUpperCase().equals("LIST"))
        {
            if(cellType == null)
                sb.append("");
            else
            if(cellType.toUpperCase().equals("TITLE"))
            {
                sb.append(" class=ListTdTitle");
                sb.append(style == null ? "" : " style=\"" + style + "\"");
            } else
            if(cellType.toUpperCase().equals("NORMAL"))
            {
                sb.append(" class=ListTd");
                sb.append(style == null ? "" : " style=\"" + style + "\"");
            } else
            if(cellType.toUpperCase().equals("SEQ"))
            {
                sb.append(" class=ListTdSeq nowrap width=1");
                sb.append(style == null ? "" : " style=\"" + style + "\"");
            } else
            if(cellType.toUpperCase().equals("DATE"))
            {
                sb.append(" class=ListTdDate nowrap width=1");
                sb.append(style == null ? "" : " style=\"" + style + "\"");
            } else
            if(cellType.toUpperCase().equals("FEE"))
            {
                sb.append(" class=ListTdFee nowrap width=1");
                sb.append(style == null ? "" : " style=\"" + style + "\"");
            } else
            if(cellType.toUpperCase().equals("CENTER"))
            {
                sb.append(" class=ListTdCenter");
                sb.append(style == null ? "" : " style=\"" + style + "\"");
            } else
            if(cellType.toUpperCase().equals("RIGHT"))
            {
                sb.append(" class=ListTdRight");
                sb.append(style == null ? "" : " style=\"" + style + "\"");
            } else
            {
                sb.append("");
            }
        } else
        if(type.toUpperCase().equals("INPUT"))
        {
            if(cellType == null)
                sb.append("");
            else
            if(cellType.toUpperCase().equals("TITLE"))
            {
                sb.append(" class=InputTdTitle");
                sb.append(style == null ? "" : " style=\"" + style + "\"");
            } else
            if(cellType.toUpperCase().equals("OBJ"))
            {
                sb.append(" class=InputTdObj");
                sb.append(style == null ? "" : " style=\"" + style + "\"");
            } else
            if(cellType.toUpperCase().equals("EXP"))
            {
                sb.append(" class=InputTdExp");
                sb.append(style == null ? "" : " style=\"" + style + "\"");
            } else
            if(cellType.toUpperCase().equals("NUM"))
            {
                sb.append(" class=InputTdNum");
                sb.append(style == null ? "" : " style=\"" + style + "\"");
            } else
            {
                sb.append("");
            }
        } else
        if(type.toUpperCase().equals("BUTTON"))
        {
            sb.append(" class=ButtonTd");
            sb.append(style == null ? "" : " style=\"" + style + "\"");
        } else
        if(type.toUpperCase().equals("SEARCH"))
        {
            sb.append(" class=SearchTd");
            sb.append(style == null ? "" : " style=\"" + style + "\"");
        } else
        if(type.toUpperCase().equals("MEMO"))
        {
            sb.append(" class=MemoTd");
            sb.append(style == null ? "" : " style=\"" + style + "\"");
        } else
        {
            sb.append("");
        }
        sb.append(nowrap ? " nowrap" : "");
        sb.append(">");
        ResponseUtils.write(pageContext, sb.toString());
        return 1;
    }

    public int doEndTag()
        throws JspException
    {
        ResponseUtils.write(pageContext, "</td>");
        if(type != null && !type.toUpperCase().equals("LIST") && !type.toUpperCase().equals("INPUT") && !type.toUpperCase().equals("BUTTON") && !type.toUpperCase().equals("SEARCH"))
            type.toUpperCase().equals("MEMO");
        return 6;
    }
}
